//
//  YMUploadRealTimeTool.m
//  PinGJByOwnerSide
//
//  Created by youmy on 2017/11/24.
//  Copyright © 2017年 lantaiyuan. All rights reserved.
//

#import "YMUploadRealTimeTool.h"
#import "YMRealTimeInfo.h"
@implementation YMUploadRealTimeTool

+ (void)send{
    
    SYDAccount * account = [SYDAccountTool getAccount];
    
    YMRealTime * realTime = [[YMRealTime alloc] init];
    realTime.cityCode = account.cityCode;
    realTime.vehicleId = account.vehicleId;
    realTime.userId = account.userId;
    realTime.busSeats = [account.busSeats integerValue];
    realTime.latitude = [YMUserLocationTool lat];
    realTime.longitude = [YMUserLocationTool lon];
    realTime.time = [[NSDate date] timeIntervalSince1970];
    realTime.userStatus = [YMOrderTool getOrderStatus];
    
    YMRealTimeInfoObj * obj = [[YMRealTimeInfoObj alloc] init];
    obj.orderNo = [YMOrderTool getOrderNo];
    obj.redisRealTime = realTime;
    
    YMRealTimeInfo *realTimeInfo = [[YMRealTimeInfo alloc] init];
    realTimeInfo.type = 2;
    realTimeInfo.desc = @"实时信息";
    realTimeInfo.obj = obj;
    
    NSString * msg = [realTimeInfo mj_JSONString];
    NSLog(@"发送实时:%@", msg);
    [[YMWebSocket sharedInstance] send:msg];
}

@end
